from enum import Enum


class Type(Enum):
    create = 1
    call = 2


class Transaction(object):
    def __init__(self, nonce):
        self.type = None
        self.nonce = nonce
        self.value = 0
        self.receiveAddress = None
        self.gasPrice = 300000000
        self.gas = 300000000
        self.data = ''.encode()
        self.chainId = 1
        self.groupId = 1
        self.extraData = ''.encode()
        self.vrs = None
        self.hashWith = None
        self.sender = None
        self.blockLimit = 0
        self.importTime = 0

    def to_dict(self):
        tx = {
            'type': self.type,
            'nonce': self.nonce,
            'value': self.value,
            'receiveAddress': self.receiveAddress,
            'gasPrice': self.gasPrice,
            'gas': self.gas,
            'data': self.data.hex(),
            'chainId': self.chainId,
            'groupId': self.groupId,
            'extraData': self.extraData.hex(),
            'vrs': self.vrs,
            'hashWith': self.hashWith,
            'sender': self.sender,
            'blockLimit': self.blockLimit,
            'importTime': self.importTime
        }
        return tx
